//跑的快闯关模式
module.exports.createRoom = function(roomId,channelService,GameRemote) {
	var basic = require("./hunanRunQuickly.js").createRoom
	var room = new basic(roomId,channelService,GameRemote)
	room.roomMode = "hunanRunQuicklyCheckpoint"
	room.beginMode = 3
	console.log("hunanRunQuicklyCheckpoint!!!!")
	//重写游戏结束方法
	room.gameOverBefore = function(win,scores) {
		var info = {
			win : room.players[win].uid,
			score : scores[win]
		}
		room.gameOver(info)
	}
	room.joinLaterFun = function(chair) {
		if(room.players[chair].playerInfo.contorl){
			room.luckys[chair] += parseInt(room.players[chair].playerInfo.contorl)
		}
	}
	//设置游戏信息
	room.setLaterInfo = function(info) {
		// console.log("info")
		// console.log(info)
		var rate = 1
		if(info.level >= 3){
			for(var i = 0;i < room.players.length;i++){
				if(room.players[i].uid < 10000){
					room.luckys[i] += info.level * 8 * rate
					if(info.level >= 6){
						room.luckys[i] += 20 * rate
						room.minCardValue = 0
					}
					rate = rate * 0.2
				}
			}
		}else if(info.level == 2){
			for(var i = 0;i < room.players.length;i++){
				if(room.players[i].uid > 10000){
					room.luckys[i] += 10
				}
			}
		}else if(info.level == 1){
			for(var i = 0;i < room.players.length;i++){
				if(room.players[i].uid > 10000){
					room.luckys[i] += 30
				}
			}
		}
	}
	return room
}